package com.hzdl.controller;


import com.hzdl.bean.AssetPlace;
import com.hzdl.bean.Finance;
import com.hzdl.bean.Project;
import com.hzdl.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * created by Administrator
 * time:19:36
 * description:
 */
@Controller
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;
    @RequestMapping("/company")
    public String reportCompany(Model model){
        List<AssetPlace> companies=reportService.reportCompany();
        model.addAttribute("companies",companies);
        return "reportCompany";
    }
    @RequestMapping("/project")
    public String reportProject(Model model){
        List<Project> projects=reportService.reportProject();
        model.addAttribute("projects",projects);
        return "reportProject";
    }
    @RequestMapping("finance")
    public String reportFinance(Model model, HttpServletRequest request){
        int i=Integer.parseInt(request.getParameter("type"));
        List<Finance> finance=reportService.reportFinance(i);
        model.addAttribute("finance",finance);
        return "reportFinance";
    }
}
